package com.xbongbong.saas.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @Auther: yingjianfeng
 * @Date: 2021/11/22 13:47
 * @Description: 阶段 执行事件相关枚举
 */
@Getter
public enum ExecutionEventEnum {
    /**
     * 签署
     */
    NULL(1, "无事件"),
    UPLOAD_IMAGE(2, "上传图片"),
    UPLOAD_ATTACHMENT(3, "上传附件"),
    FIELDATTR_EDIT(4, "字段编辑"),
    LINK_DATA_EDIT(5, "编辑关联数据"),
    ;
    /**
     * 1. 无事件。2.上传图片。3.上传附件。4.字段编辑。5.编辑关联数据
     */
    private Integer type;
    /**
     * 名字
     */
    private String name;

    ExecutionEventEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }
    public static ExecutionEventEnum getByCode(Integer code) {
        for (ExecutionEventEnum temp : values()) {
            if (Objects.equals(code, temp.getType())) {
                return temp;
            }
        }
        return null;
    }
}
